home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Dylan Related / Mindy / Mindy 1.2 - portable sources / interp / ext-init.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-15  |  1.4 KB  |  51 lines  |  [TEXT/ttxt]

  1. /**********************************************************************\
  2. *
  3. *  Copyright (C) 1994, Carnegie Mellon University
  4. *  All rights reserved.
  5. *
  6. *  This code was produced by the Gwydion Project at Carnegie Mellon
  7. *  University.  If you are interested in using this code, contact
  8. *  "Scott.Fahlman@cs.cmu.edu" (Internet).
  9. *
  10. ***********************************************************************
  11. *
  12. * $Header: ext-init.c,v 1.4 94/11/30 16:16:37 rgs Exp $
  13. *
  14. * This file does whatever.
  15. *
  16. \**********************************************************************/
  17.  
  18. #define _ANSI_ARGS_(a)  () /* Hack to avoid loading "std-c.h" */
  19.  
  20. #include "mindy.h"
  21. #include "gc.h"
  22. #include "bool.h"
  23. #include "extern.h"
  24. #include "error.h"
  25.  
  26. #include "extern1.def"
  27.  
  28. void add_explicit_symbol(char *name, void *address)
  29. {
  30.     struct foreign_file *syms = FOREIGN_FILE(mindy_explicit_syms);
  31.     if (syms->sym_count >= extern_sym_count)
  32.     error("Number of 'external definitions' does not match the count");
  33.     syms->syms[syms->sym_count].name = name;
  34.     syms->syms[syms->sym_count++].ptr = address;
  35. }
  36.  
  37. void build_explicit_syms(void)
  38. {
  39.     struct foreign_file *syms;
  40.     int extra_size = (extern_sym_count - 1) * sizeof(struct symtab);
  41.  
  42.     mindy_explicit_syms = alloc(obj_ForeignFileClass, 
  43.                 sizeof(struct foreign_file) + extra_size);
  44.     syms = FOREIGN_FILE(mindy_explicit_syms);
  45.     syms->file_name = obj_False;
  46.     syms->sym_count = 0;
  47.     syms->extra_size = extra_size;
  48.  
  49. #include "extern2.def"
  50. }
  51.